use "C:\Users\mjoshi2\Box\2024 Research\Colombia Data & Research\Research\Gender Research\GenderAnalysis\Data\2024-01-26Subthemedata.dta", clear
log using "C:\Users\mjoshi2\Box\2024 Research\Colombia Data & Research\Research\Gender Research\GenderAnalysis\Data\PSJ Data\PSJ Subtheme.smcl", replace
set seed 122574

//Figure 1
graph bar (rawsum) gen_no_imp (rawsum) gen_min_imp (rawsum) gen_int_imp (rawsum) gen_full_imp if month==12, by(year_month) blabel(total)


//Table 1

newey imp_rate gen_full_imp gen_min_imp gen_int_imp i.year_month i.subtheme_number, lag(1)force
newey imp_rate gen_full_imp gen_min_imp gen_int_imp i.subtheme_number, lag(1)force
newey imp_rate total_gen_stipul gen_full_imp gen_min_imp gen_int_imp i.year_month, lag(1)force

//Only subtheme with gender stipulaitons.
newey imp_rate gen_full_imp gen_min_imp gen_int_imp i.year_month i.subtheme_number if total_gen_stipul>0, lag(1)force
newey imp_rate gen_full_imp gen_min_imp gen_int_imp i.subtheme_number if total_gen_stipul>0, lag(1)force
newey imp_rate total_gen_stipul gen_full_imp gen_min_imp gen_int_imp i.year_month if total_gen_stipul>0, lag(1)force

//First three are based on Model 2
gen MYVAR = gen_min_imp 
newey imp_rate MYVAR gen_full_imp gen_int_imp i.subtheme_number, lag(1)force
margins, atmeans at(MYVAR=(0(1)6)) saving(file2, replace)
drop MYVAR

gen MYVAR = gen_int_imp 
newey imp_rate gen_full_imp MYVAR gen_min_imp i.subtheme_number, lag(1)force
margins, atmeans at(MYVAR=(0(1)3)) saving(file3, replace)
drop MYVAR

gen MYVAR =  gen_full_imp
newey imp_rate gen_int_imp gen_min_imp MYVAR i.subtheme_number, lag(1)force
margins, atmeans at(MYVAR=(0(1)3)) saving(file4, replace)
drop MYVAR

//Based on Model 3
gen MYVAR =  total_gen_stipul
newey imp_rate gen_int_imp gen_min_imp gen_full_imp  MYVAR i.year_month, lag(1)force
margins, atmeans at(MYVAR=(0(1)9)) saving(file1, replace)
drop MYVAR

combomarginsplot file1 file2 file3 file4, labels("Freq. gender stipulation with min. implementation" "Freq. gender stipulation with int. implementation" "Freq. gender stipulation with full implementation" "Freq. gender stipulation") xtitle("")


//Appendix Table 2b
sum imp_rate gen_no_imp gen_min_imp gen_int_imp gen_full_imp total_gen_stipul



//Appendix Table 4a: OLS results Subtheme analysis

xtreg  imp_rate gen_full_imp gen_min_imp gen_int_imp i.year_month, fe
xtreg  imp_rate gen_full_imp gen_min_imp gen_int_imp, fe
xtreg  imp_rate total_gen_stipul gen_full_imp gen_min_imp gen_int_imp i.year_month 

//Only subtheme with gender stipulaitons.
xtreg  imp_rate gen_full_imp gen_min_imp gen_int_imp i.year_month if total_gen_stipul>0, fe
xtreg  imp_rate gen_full_imp gen_min_imp gen_int_imp if total_gen_stipul>0, fe
xtreg  imp_rate total_gen_stipul gen_full_imp gen_min_imp gen_int_imp i.year_month if total_gen_stipul>0 


//Appendix Table 4b: Population average results

xtgee  imp_rate gen_full_imp gen_min_imp gen_int_imp i.year_month i.subtheme_number,family(gaussian) corr(ar1)
xtgee imp_rate gen_full_imp gen_min_imp gen_int_imp i.subtheme_number, family(gaussian) corr(ar1)
xtgee imp_rate total_gen_stipul gen_full_imp gen_min_imp gen_int_imp i.year_month , family(gaussian) corr(ar1)

//Only subtheme with gender stipulaitons.
xtgee imp_rate gen_full_imp gen_min_imp gen_int_imp i.year_month i.subtheme_number if total_gen_stipul>0, family(gaussian) corr(ar1)
xtgee imp_rate gen_full_imp gen_min_imp gen_int_imp i.subtheme_number if total_gen_stipul>0, family(gaussian) corr(ar1)
xtgee  imp_rate total_gen_stipul gen_full_imp gen_min_imp gen_int_imp i.year_month if total_gen_stipul>0 , family(gaussian) corr(ar1)

//Appendix Table 6e.

reg  imp_rate gen_full_imp gen_min_imp gen_int_imp if year==2023 & month==4, vce(robust)
reg imp_rate total_gen_stipul gen_full_imp gen_min_imp gen_int_imp if year==2023 & month==4, vce(robust)
 
//Only subtheme with gender stipulaitons.
reg  imp_rate gen_full_imp gen_min_imp gen_int_imp if total_gen_stipul>0 & year==2023 & month==4, vce(robust)
reg  imp_rate total_gen_stipul gen_full_imp gen_min_imp gen_int_imp if total_gen_stipul>0 & year==2023 & month==4, vce(robust)  



log close
